sort of compiles. a few more functions to implement