version 1 of completed code