Updated code to reflected Java 1.8, fixed warnings