improve output and refactor comparison