first working version for tomcat. still a lot of things need to be fixed.