Fixed some bugs and open ended code

fixed some open ended stuff and fine tuned some stuff