small logging and refactor return