added cleanTest before build and other refactorings