Refactoring, cleaning up