diff --git a/services.runtime.inc.old.inc b/services.runtime.inc
index 7db15b5..14b4d4b 100644
--- a/services.runtime.inc.old.inc
+++ b/services.runtime.inc
@@ -154,6 +154,41 @@ function services_controller_execute($controller, $args = array(), $options = ar
   if ($server_info->debug) {
     watchdog('services', 'Called arguments: <pre>@arguments</pre>', array('@arguments' => print_r($args, TRUE)), WATCHDOG_DEBUG);
   }
+  
+  //check recquired arguments and defaults for option al arguments
+  $number_of_passed_arguments = count($args);
+  $number_of_potential_arguments = count($controller['args']); 
+
+  //check for too much arguments
+  if ($number_of_passed_arguments > $number_of_potential_arguments) {
+    return services_error(t('Too much arguments supplied, expected a maximum of @expected but got @got', array(
+      '@got' => $number_of_passed_arguments , '@expected' => $number_of_potential_arguments)), 400);
+  }
+  
+  //loop through the arguments definitions for the callback to check for recquired arguments and set default values for optional arguments
+  $number_of_recquired_arguments = 0;
+  foreach($controller['args'] as $key => $value){
+    if (isset($value['optional']) && $value['optional'] == FALSE) {
+      $number_of_recquired_arguments++;
+    }
+    else {
+      //check and set default values for optional arguments
+      if (isset($value['default value'])) {
+        //if not set, create a default value
+        if (!isset($args[$key])) {
+          $args[$key] = $value['default value'];
+        }
+      }
+    }
+  }
+  
+  //check for too few arguments
+  if ($number_of_recquired_arguments > $number_of_passed_arguments) {
+    return services_error(t('Too few arguments supplied, expected a minimum of @expected recquired arguments but got only @got', array(
+      '@got' => $number_of_passed_arguments , '@expected' => $number_of_recquired_arguments)), 400);
+  }
+  
+  //all good, now get the result from the callback
   $result = call_user_func_array($controller['callback'], $args);
 
   // Check if the result should be post-processed
