Lots of gradle fixes, started writing tests