Moved library loading function to separate file.