separated functions into files per instructions.  Fixed complete function