fixed guard problems
implemented #3 feature