updated half-written code