bugfixing, refactoring