refactoring... so far it's fine