Some cleanup for old codes
Some cleanup
Merged conflicts