refactoring, added few features