added log model and migration
refactoring + logging