added some code for the functions. its kind of all of the place, ill continue editing it