adds resource as well as refactoring for java