Refactoring and improved tests

Fixed alternative syntax parsing AND, OR, NOT etc.
Improved build.xml
Increased test coverage