Made changes to sim_api.cpp as per Arjun