RSP fixes and code cleanups