fix some bugs, clean up, add gravity example