Minor bug fixes and gradle implementation