redid all functions, seems to function now