Added .idea to gitignore
Refactored out functionality into helper classes.