Extract custom keyword parsing into a function