added more features at client side, refactor codes