reorganize code #2