A bunch more refactoring..
A bunch more refactoring