change stucture and add some tests