Forgot to commit before leaving. Since then improved flow and commenting. Refactored for style and readability