shanes tests and refactor