fixes & refactoring