functionality mostly done