Refactor positioning and resizing methods.