fix calculation and introduce constants