Rewrote resizer function to better treat horizontal/vertical viewport