move calculations out into methods