final version without passing tests