Refactored code using some boolean convenience functions to improve code readability.

Signed-off-by: John May <john.wilkinsonmay@gmail.com>