Refactoring and add pom.xml for 1.8