Improved toolbar resize script

Uber-fied the script. Wrote processes into a function. Works dynamically
and in all scenarios.