refactorings & cleanup