Add .gitignore
Use log instead of fmt for logging
A bit more error/state handling