move begin/rescue to proper place