finally finished version 1