break out into lib