refactor and add open option
Merge pull request #10 from charleschu/Allen/2013-03-11

READY:refactor and add open option