Defined all funtions as such.
Simpler code; better variable names.