Working guards

Implemented and tested.