First commit rough sketch of final code