Add some tests with slight refactors