beforeShow method added