Fixing probems with data, minor code cleanups