ardm4 implemented. Probably correct. Cleanup included