fixed some code and added some new.