fix some compilation errors and bugs
Basic signs of life
Add some comments and update TODO