add logger and small refactor. fixed #113 #112