algorithm works, backend mostly set up