first working copy of the functions