added log facility
Some changes