Various additions and cleanups