made it more into a library pattern