Misc clean up
Futher simplify code