Code cleanup

Optimized code for runtime testing