optimize math a little