added action handler, moving all action handling there