fixed tests, needs refactoring though