added missing functions to test; restructured the code - introducing
some comments, moving code-blocks etc.