fixed all compile errors and most checkstyle errors FIRST COMPILING VERSION