Moved functions in library.py