#130 - Fixed spec failures and did some refactoring.