General code cleanup. Removed blocks of code now replaced