added many new features and fixed bugs