Improve log functionality
More pythonic 'if'