go back to Maven
move internal types into separate files
extract patterns to avoid re-compiling