cleaned code still need to fix bug with row