Some refactoring..