Refactor ask function.