functionality mostly finished