removed magin numbers and added comments