Code cleanup and copy fixes