refactoring crap code (logger and ES)