function calls need to be fixed up and more scalable