Cleaned up of global functions