Moved the project ot maven. Cleaning the code

Maven will now build the project instead of manually doing the whole
thing. Also the code used local variables for things that won't change
in the agent lifetime