Refactored out guards in it's own file