Refactoring to use gradle build system