Internal Documentation

Properly commented the code and added some DEBUG and TODO stubs