Fixed Log issue + Refactor