Having the return statement down here confuses me because the logic above was so complicated. It would be better at the bottom of the outermost if statement above.  (If you were going to keep those three nested ifs).