pulling out mock as a separate function