Closes #58 updated guard code and added unit test.