cleaning up more code and loose ends