Some refactoring!