first full implementation without watching the solution