Many changes, more comments and types