Refactor + build.xml
Several improvements