changed to a library that can be called as a script rather than a script only