small code maintenance and added comments