refactor to make it eaiser to use as a library