Remove old dead code; silence compiler warnings; tidy up.