lots of cleanup

Signed-off-by: Marc MacLeod <marbemac@gmail.com>