commented and cleaned code 2