solved double square and added comments