First dump of working yet buggy code.