Major refactoring in order to adapt to alltested test/folder structure
and to conform to jshint validations. Added some missing tests.