put together the function

made function