changed var current to current_tag and a call to an exit fuction of the current page when function switch is called