Added implementation & test code for simulator