Some refactoring...