Basic framework, need to sort out order and structure of the code