removing unnecessary tests and changing to one liner before()