further refactoring to make the code more awesome
more improvements