added control functionality, some bugs may found, need to check.