fixed warnings and errors related to scope of variables, parameters should be final, method is not designed for extension, override annotations, logging, redundant operator if.