Added cross section, moved code around a bit