code clean up; add comments and etc.
update datacost funct