Some improvements

Junit, java.util.logging, exceptions, enum for singleton.