Move code to integrate more with gradle