move ground stuff to Ground.js, minor tidyups in main