modify ugly code