Code cleanup + fixes to run the apps on jboss.