refactoring and SIM improvements