started refactoring ..