This probably needs to return before trying to dereference a nil pointer below?