splitting functions; now outputs cases