factor out some common actions
Major reoganization