Move library calls to own file