moved more stuff to function pointers