Added 3-stage modifications, but not yet debugged