totally refactored all the code :)