Refactored to a library and added simple unit tests
Added support for parentheses