Code cleanup and pom.xml

Making the library a little smaller due to less redundancy.
Also enables building the lib directly via maven, thus easing deployment to maven central as described in #4.