Workflow optimize

This code fixed issue #35 and #27