Code cleanup, changes, fixes and other 1.7 stuff