added many tests and basic metadata support