Simplify datalayer, remove unused code lines.

FIXME: datalayer really needs to be refactored into more classes.