added more functionality
fixed some bugs need to fix implementation level