created 3 functions, final