first attempt, partially implemented part 1