added more client side features, refactor codes