refactored appserver wrapper script