Refactor a bit to help reduce redunancy from #110