added template and cleaned up record