Move most functionality into named methods