added curve function TODO make curve simpler