cleaned up some whitespaces and condition more sensible