Basic framework is now working, correctness not tested