breaks into several functions