third function done, everything works