Story 40306505: Refactored controller for resizing and accounted for margins, padding, sized parents, etc.