Updated few programs

Cleaned up the code , made few modifications in the code and in the
comments