Big update. TODO recommit it later.