implemented tab-switch functionality on save