Initial naive version (but working!)