finished adding in remaining functions, updated version