updated hideRequired function