modified C from repo 1