Some cleanup
Attempt to make it backward compatible