Improved the function declarations
Cleaning the code a little bit more

Moved the #defines and #includes to a more suitable home.