Tidy up implementation of multiple actions and remove duplicated code.