The pull request with all the code.

Ternary if statements should be avoided... not very readable