Improved <on save> funcionality