General refactoring & changes