Refactor: Replace integral type with bool
Refactor: Localize variables
Refactor: Replace magic number with named constant
Refactor: Move definitions from static to anonymous namespace