fixed warnings and errors related to scope of variables and methods, parameters should be final, method is not designed for extension.