implemented most of it for first time without looking at the implemented code. dictionaries for functions is really neat!