General refactor

This includes reverting previous formatting and naming changes that are irrelevant to
this patch.