Fixes & refactoring