Refactor

Here's the changes Sam and I talked about on Friday.