Cleanup of unused legacy code, some minor stuff