added many types and fixed bugs