The code is now more organized and porperly documented.