split up for better testing