added enhanced path chekcing logic for return statements