Abstracted as best I could, also got testing coverage up in the process.