added slfj logging and cleaned up code