a lot of BUGs fix and many features implementation