Final refactor and writeup.