changed precision from tl to int
reduced code