changed some syntax and added comments