Merged changes from Fabian into project and added unit tests