implemented dynamic changing of columns and rows