added more features, bug fix