Refactor and remove logs