move utilities into main class to allow testing