Cleaned code & added comments