Code formatting and refactoring, gitignore update
Code formatting and refactoring