major refactoring done