Added log and refactored variables names