refactored some methods to be more readable, added alot of comments and more test(ies)