replaced many magic numbers for layout with variables