finally done. hope there's no obvious bug