updated initial code