Code totallly written, now fixing weird errors that are happening in sim