added revision 1, need to fix some more bugs and add doc;