added logic flow