Simplified Code and updated pom.xml