Improve structures, fix some small bugs.