Code updated with comments

Code updated with comments .
Removed code for the array.
Removed un-necesary variables
Removed all the sysouts