Updated Tomcat waiting logic.
Clean up added.