Basic framework mostly done