Updated comments and cleaned code