Various cleanups (delete variable) and changes due to code review