added most base code