Refactored functions to use common string representation
Added use of constants, added and re-enabled unit tests