More general refactoring

This needs to happen...and there's a lot more where this came from