moved get command into a function