added lots of code