started writing tests for current implementation + bugfixes