Minor bugs fixed and old code removed.