Refactored code.

Resused CATALINA_PID variable throughout the script
Export some CATALINA_* variables and pass it through as environment variables.
Disabled the function parseOptions