Refactor given when

Make tests pass on perl 5.18, 5.16 and 5.14 after getting rid of given & when.