simulation testing
debugging
merged with Allan's changes