created separate functions for each case