Lots of changes, more comments, too tired to properly commit