added handling for cases of both resizing and inital mobile sizing