some more changes & refactoring