Fetching train detail through api and some code revamp