Backend; cleanups and minor fixes