reorganize code.