Better error handling
Fancy debug output
Code cleanning