Cleanup and divide so it can use less inner classes
quick fix to make it build, stateful EJB CL is screwed