fixed prof's code. note to self do a pull request on repo later