Updated type check
Updated method definition
Added debounced browser resize event