Pass sim by ref, resolves some warnings.