First function

First attempt at function to extract name from query.