Make the code run and add tests.