final commit. code refactoring done.