early sql implementation, needs work