Code clearing and simplification