bunchochangesadds

Added some things and tried to make its structure a little more
readable.