refactor code for csv gets methods