added function to handle the hiding