cleanedup the source code and reformmatted a lot of stuff.