added basic sim function