Remove unused parameter
Move some functions above where they are used
Use tuples wherever possible
Merge