refactored to better follow spec