Moved stuff around, added comments and TODOs