Fixed up tests and added guard