Add .gitignore, fix some stupid bugs, clean up.