some refactoring to make things make more sense