major changes

change fuctions and rewrote parts