Changed if/else to guards, fixed precision