added new features and bug fixes