Major overhaul in code design