Fix get_output, refactor and comments