Added 'make check' target, added missing headers, removed older code.