diff --git a/client/sbs_client.bat b/client/sbs_client.bat
index 1d4b61ff91f0b4fd97ba9e8be194d68b1e614000..d38be5b30d0ce2b8dadd2ba01d1ae49ff8efb71f 100644
--- a/client/sbs_client.bat
+++ b/client/sbs_client.bat
@@ -1,4 +1,7 @@
+@echo off
+rem Using the sh variant through msys(git) or similar linux like environment is recommended
+
 :loop
-	C:\py\sbs\client\sbs_client.py
-	timeout /t 5
-	goto loop
\ No newline at end of file
+	%cd%\sbs_client.py %1
+	timeout /t %2
+	goto loop
diff --git a/client/sbs_client.py b/client/sbs_client.py
old mode 100644
new mode 100755
index 58c3ed984ec6d933f168798363ce839f09fe3cbe..d196fa63c897c4953680f35747ad9efef2e8e490
--- a/client/sbs_client.py
+++ b/client/sbs_client.py
@@ -1,46 +1,85 @@
-# -*- coding: utf-8 -*-
+#!/usr/bin/python
+# coding=utf-8
 """
 Created on Tue Feb 20 21:33:57 2018
 
 @author: veskuh
 """
 
-import cv2
-import requests
+import os, sys, cv2, requests, logging, re
 from requests_toolbelt.multipart.encoder import MultipartEncoder
-import os
 
 # Image file name and location
-image = ".\images\image.jpg"
+TMP_IMAGE = os.path.join(os.path.normpath(os.path.join(os.getcwd(), 'images')), 'image.jpg')
+# Server URI
+SERVER_URL = "tensorflow.stop.capstone.utu.fi"
 
+# logging.basicConfig(filename = os.path.normpath(os.path.join(os.getcwd(), 'debug.log')), level = logging.DEBUG)
+logging.basicConfig(filename = os.path.normpath(os.path.join(os.getcwd(), 'error.log')), level = logging.ERROR)
 
 # Sending image to server
-def sendImage():
-    # Send local image file to tensorflow-client 
-    multipart_data = MultipartEncoder(
-    fields={
-        # a file upload field
-        "image": ("image.jpg", open(image, "rb"), "image/jpg"),
-        "stop_code": "Test"
-       }
-    )
-    
-    response = requests.post("http://tensorflow.stop.capstone.utu.fi/api/v1/classifyImage/", data=multipart_data,
-              headers={"Content-Type": multipart_data.content_type})
+def sendImage(stopCode = None):
+    # Send local image file to tensorflow-client
+    stopCode = stopCode if stopCode else "unknown"
+    try:
+        with open(TMP_IMAGE, "rb") as fp:
+            multipart_data = MultipartEncoder(
+                fields = {
+                    "stop_code": stopCode,
+                    "image": (os.path.basename(TMP_IMAGE), fp, "image/jpeg")
+               }
+            )
+
+            response = requests.post("http://" + SERVER_URL + "/api/v1/classifyImage/",
+                data = multipart_data,
+                headers = {"Content-Type": multipart_data.content_type}
+            )
+
+            if response.status_code != 200:
+                raise Exception('Service unavailable')
+
+    except Exception as err:
+        logging.error('An error has occurred whilst sending the file: "{0}", for: {1}'.format(err, stopCode))
 
 # Removing image for security purposes 
 def removeImage():
-    os.remove(image)
+    try:
+        os.remove(TMP_IMAGE)
+    except Exception as err:
+        logging.error('An error has occurred while deleting temporary file: "{0}"'.format(err))
 
 # Taking a picture from default webcam and saving it
-def takePicture():
-    cap = cv2.VideoCapture(0)
-    
-    ret, frame = cap.read()
+def takePicture(cameraIndex):
+    try:
+        cap = cv2.VideoCapture(cameraIndex)
+        if not cap.isOpened():
+            raise Exception('Camera not available')
+
+        ret, frame = cap.read()
+        if not ret:
+            raise Exception('Unable to capture image')
+
+        cv2.imwrite(TMP_IMAGE, frame)
+        cap.release()
+
+        if not os.path.isfile(TMP_IMAGE):
+            raise Exception('Saving image to disk failed')
+
+        return True
+    except Exception as err:
+        logging.error('An error has occurred while capturing camera image: "{0}"'.format(err))
+        return False
+
+def main(argv):
+    if argv != None and (len(argv) <= 1 or not re.match("^[\w\d_-]+$", argv[1])):
+        return False
+
+    if takePicture(0):
+        sendImage(argv[1])
+        removeImage()
 
-    cv2.imwrite(image,frame)
-    cap.release()
+    return True
 
-takePicture()
-sendImage()
-removeImage()
\ No newline at end of file
+if __name__ == "__main__":
+    if not main(sys.argv):
+        print("Stop identifier not provided (missing argument)")
diff --git a/client/sbs_client.sh b/client/sbs_client.sh
new file mode 100755
index 0000000000000000000000000000000000000000..50941c1123243cc09b4fde3b7d33c4a4bba9ad0e
--- /dev/null
+++ b/client/sbs_client.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ "$#" -ne 2 ]; then
+	echo "Usage: $0 stop_code freq_secs" >&2
+	exit 1
+fi
+
+if [ "$2" -lt 3 ]; then
+	echo "freq_secs must be larger than or equal to 3" >&2
+	exit 1
+fi
+
+while true
+do
+	python "./sbs_client.py" "$1"
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		exit 1
+	fi
+	sleep $2
+done