preliminary functionality almost done