Add better css class handling on hide