fixed tostring and added comments