Cleaned up ugen functions