making functions for items 1 and 2

making functions for items 1 and 2