Improved code structure and added .gitignore.