made it a little fancier; made it testable