Code cleanup and archaic code removed