started refactoring...