Refactoring Fun

Adding tests, etc..