Java refactoring - Made more changes to code