basic refactor
read more.
todo : need to handle indices