Fixed tests and made code compatible with tests again