summiting this code

submitting this code with comments