properly working codes version 1