Add comments and restructure some things