Updated for better maven compat.  Code refactoring