fixed the main simulate function, still giving warnings.