improved some math