Refactored and added gradle build