First attempt at a test, slight refactor