implements the rest of the functions