updated lots of code