Functional version; missing only an end-game scenario