Cleaned up to avoid undefined being overwritten. Updated description at top