Finished a couple of functions and unit tests