Added Inner function and test

Move returns end of func; you have declared a single var, so you may as well return it only once.