the majority of background code