First and hopefully final commit. Implemented all the code so that the free tests pass beautifully.