Modified code to hit the db less and made improvements from backend to frontend. [MJ-374]