Pass location & type as params, rather than calling inside the function.