Finish refactor of both programs