function for creating cases