Code cleanned and added comments