Heavy refactoring...