Added gitignore.
Refactored main script into multiple modules.