Code cleaning; moved some class variables into the method where I could, removed redundant imports.