completed print, append and prepend functions