Made save_to_stream function available outside of library