Removed unnecessary comments, implemented sessions and simplified code.