updated code version 1