I believe that these 3 lines can be tweaked a bit, to avoid repetitive stuff and you can return it right away instead of saving it on a variable and return later