Considering library design, this function with many side effects should not be executed in a library.