cleaned code

added comments