Refactored code.
Not sure of the difference between applicationFrame and bounds.  Both seem to work.