fixes and added comments